package com.itheima.ood.lambda.demo01;

public class SwimmingDemo01 {

    public static void main(String[] args) {

        SwimmingImplement swimmingImplement = new SwimmingImplement();
        goSwimming(swimmingImplement);

        //站在面向对象的角度
        //先写goSwimming();再考虑参数，有助于理解匿名内部类
//        goSwimming(new Swimming() {
//            @Override
//            public void swimming() {
//                System.out.println("swimming......2.....");
//            }
//        });
//
        //站在函数式编程思想的角度去调用goSwimming方法，关注函数本身，即swimming()方法
        //swimming()方法没有参数，因此->前面的一对()就没有参数，
        //goSwimming()内部的()->{}指的就是swimming()方法
//        goSwimming(() -> {
//            System.out.println("swimming......3.....");
//        });

        Swimming swimming = new Swimming() {
            @Override
            public void swimming() {
                System.out.println("swimming....");
            }

            @Override
            public void drink() {
                System.out.println("drink....");
            }
        };

        swimming.swimming();
        swimming.drink();

    }

    public static void goSwimming(Swimming swimming){

        swimming.swimming();
    }

}
